package com.example.mapdata.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo {
    @ApiModelProperty("状态码")
    private Integer code; // 状态码
    @ApiModelProperty("提示信息")
    private String message; // 提示信息
    @ApiModelProperty("是否成功")
    private boolean success; // 是否成功
    @ApiModelProperty("数据")
    private Object data; // 数据

    public ResultVo(Object data) {
        this.code = 200;
        this.message = "查询成功";
        this.success = true;
        this.data = data;
    }

    public ResultVo(String message, boolean success) {
        if (success) {
            this.code = 200;
        } else {
            this.code = 0;
        }
        this.message = message;
        this.success = success;
    }

    public ResultVo(int code, String message, boolean success, Object data) {
        this.code = code;
        this.message = message;
        this.success = success;
        this.data = data;
    }

    //public ResultVo(int i, String 获取成功, boolean b, Object loginUser) {
    //}
}

